summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-30 11:28:30 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-30 11:28:30 -0700
commite112d781ea5ffc4186e7d70dba595b5a233335a8 (patch)
treebea2120759c77e20e140e0958393aeef936f0a24
parent5898cb722a225ca6a876152ae365c2de3a6e81ac (diff)
downloadstage-e112d781ea5ffc4186e7d70dba595b5a233335a8.tar.gz
stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.tar.bz2
stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.tar.xz
stage-e112d781ea5ffc4186e7d70dba595b5a233335a8.zip
Added vim highlighting for stage scripts.
-rw-r--r--support/vim/ftdetect/stage.vim1
-rw-r--r--support/vim/ftplugin/stage.vim24
-rw-r--r--support/vim/syntax/stage.vim77
-rw-r--r--test.stage5
4 files changed, 107 insertions, 0 deletions
diff --git a/support/vim/ftdetect/stage.vim b/support/vim/ftdetect/stage.vim
new file mode 100644
index 0000000..b826efe
--- /dev/null
+++ b/support/vim/ftdetect/stage.vim
@@ -0,0 +1 @@
au BufRead,BufNewFile *.stage set filetype=stage
diff --git a/support/vim/ftplugin/stage.vim b/support/vim/ftplugin/stage.vim
new file mode 100644
index 0000000..96ed1b5
--- /dev/null
+++ b/support/vim/ftplugin/stage.vim
@@ -0,0 +1,24 @@
1" Vim filetype plugin file
2" Language: Stage
3
4" Only do this when not done yet for this buffer
5if exists("b:did_ftplugin")
6 finish
7endif
8
9" Don't load another plugin for this buffer
10let b:did_ftplugin = 1
11
12" Set format options -- allow comment formatting with gq, but disable
13" other processing
14setlocal fo-=tcrowan2 fo+=q
15
16" Set 'comments' to be the same as C/C++
17setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
18
19" Win32 can filter files in the browse dialog
20if has("gui_win32") && !exists("b:browsefilter")
21 let b:browsefilter = "Stage files (*.stage)\t*.stage\n" .
22 \ "All Files (*.*)\t*.*\n"
23endif
24
diff --git a/support/vim/syntax/stage.vim b/support/vim/syntax/stage.vim
new file mode 100644
index 0000000..b5dab28
--- /dev/null
+++ b/support/vim/syntax/stage.vim
@@ -0,0 +1,77 @@
1" Vim syntax file
2" Language: Stage
3" Maintainer: Mike Buland :)
4" Last Change: 2012 Dec 30
5
6" For version 5.x: Clear all syntax items
7" For version 6.x: Quit when a syntax file was already loaded
8if version < 600
9 syntax clear
10elseif exists("b:current_syntax")
11 finish
12endif
13
14" Keywords
15syn keyword Conditional if then else
16syn keyword Loop for each do in while
17syn keyword Logic not and or
18syn keyword Statement setup enter
19syn keyword Todo TODO FIXME XXX
20syn keyword Type function command situation game global player
21syn keyword Constant null true false
22syn keyword Builtins display goto exists delete
23
24syn match TargetProcess /[a-zA-Z_][a-zA-Z0-9_]*:/he=e-1
25
26syn cluster CommentGroup contains=Todo
27
28syn match Special display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
29syn match Special display contained "\\\(u\x\{4}\|U\x\{8}\)"
30
31" TODO: do we want to end at end of line too?
32syn region tripSingleString start=+'''+ skip=+\\\\\|\\'+ end=+'''+ contains=Special,CmdEx
33syn region tripDoubleString start=+"""+ skip=+\\\\\|\\"+ end=+"""+ contains=Special,CmdEx
34syn region singleString start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=Special,CmdEx
35syn region doubleString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=Special,CmdEx
36syn region sitName start=+<<+ end=+>>+ contains=Special,CmdEx
37
38syn region CmdEx start=+$(+ skip=+"\|\\)\|\\\\+ end=+)+
39
40syn case ignore
41syn match Numbers display transparent "\<\d\|\.\d" contains=Number,Float,OctalError,Octal
42syn match Number display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
43" Hex
44syn match Number display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
45syn match Octal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
46syn match OctalZero display contained "\<0"
47syn match Float display contained "\d\+f"
48syn match Float display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
49syn match Float display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
50syn match Float display contained "\d\+e[-+]\=\d\+[fl]\=\>"
51" Flag bad digits in octal
52syn match OctalError display contained "0\o*[89]\d*"
53syn case match
54
55
56syn region cppComment start="#" skip="\\$" end="$" contains=@CommentGroup keepend
57syn region cComment start="/\*" end="\*/" contains=@CommentGroup fold
58syn region cppComment start="//" skip="\\$" end="$" contains=@CommentGroup keepend
59
60
61syntax region Block start="{" end="}" transparent fold
62
63hi def link OctalError Error
64hi def link cComment Comment
65hi def link cppComment Comment
66hi def link tripSingleString String
67hi def link tripDoubleString String
68hi def link singleString String
69hi def link doubleString String
70hi def link sitName String
71hi def link cmdEx String
72hi def link Constructor Operator
73hi def link Logic Statement
74hi def link Loop Conditional
75hi def link Builtins Function
76hi def link TargetProcess Type
77
diff --git a/test.stage b/test.stage
index 38e3735..0963143 100644
--- a/test.stage
+++ b/test.stage
@@ -69,6 +69,11 @@ situation <<stuff>>
69 { 69 {
70 display("You can't eat " + object ); 70 display("You can't eat " + object );
71 } 71 }
72
73 command: "eat" object "now"
74 {
75 display("Alright, fine, eat " + object + " now..." );
76 }
72 77
73 setup 78 setup
74 { 79 {